import ajax from '@/http/axios'

import { encryptData } from '@/utils/encrypt'

export function login(username, password, captcha) {
  const identification = username
  const wordofcommand = password
  const nnljwdysjsdsb = encryptData(
    JSON.stringify({ identification, wordofcommand, captcha })
  )
  const params = { nnljwdysjsdsb }
  return ajax({
    url: '/login/login',
    method: 'post',
    params
  })
}

export function getVerificationCode() {
  return ajax({
    url: '/login/getVerificationCode',
    method: 'post'
  })
}

export function getUserInfo() {
  return ajax({
    url: '/system/user/getUser',
    method: 'post'
  })
}

export function logout(data) {
  return ajax({
    url: '/login/logout',
    method: 'post',
    data
  })
}
